package com.by.toolkitspring.customizeannotation;

import lombok.extern.slf4j.Slf4j;

import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Map;

/**
 * 扫描所有自定义的类注解上下文
 *
 * @author YanBingHao
 * @since 2023/12/25
 */
@Slf4j
@SuppressWarnings({"unused"})
public class ByAnnotationContext {

    private Map<? extends Class<? extends Annotation>, List<ByAnnotationProcessor.CustomizeAnnotationInfo>> customizeAnnotationInfoMap;

    /**
     * 初始化上下文
     *
     * @param customizeAnnotationInfoMap
     */
    public ByAnnotationContext(Map<? extends Class<? extends Annotation>, List<ByAnnotationProcessor.CustomizeAnnotationInfo>> customizeAnnotationInfoMap) {
        this.customizeAnnotationInfoMap = customizeAnnotationInfoMap;
    }

    /**
     * 根据自定义注解类获取被注解的类信息
     *
     * @param clazz
     * @return
     */
    public List<ByAnnotationProcessor.CustomizeAnnotationInfo> getAnnotationInfos(Class<? extends Annotation> clazz) {
        return customizeAnnotationInfoMap.get(clazz);
    }


}
